package
{
	public class IRQ
	{
		/******* Console Events  *******/
		/* Device IRQ Numbers */
		public static const FocusIRQ:uint = 0;
		public static const KbdIRQ:uint = 1;
		public static const MouseIRQ:uint = 2;
		/* Signals: Mouse */
		public static const MouseDown:uint = 0;
		public static const MouseUp:uint = 1;
		public static const MouseMove:uint = 2;
		public static const MouseOut:uint = 3;
		public static const MouseOver:uint = 4;
		public static const MouseWheel:uint = 5;
		/* Signals: Keyboard */
		public static const KbdMake:uint = 0;
		public static const KbdBreak:uint = 1;
		/* Signals: Focus */
		public static const FocIn:uint = 0;
		public static const FocOut:uint = 1;
		/*******************************/
		/* other interrupts... */
		
		public static var dbg:Boolean = false;
		
		/* do we need a queue? */
		/*
		private static var IntQueue:Array = new Array();
		IntQueue.push([device, signal, va, vb]);
		*/
		public static var device:uint, signal:uint;
		public static var va:int, vb:int;
		public static var IF:Boolean = false;
		
		/* Assert Interrupt */
		public static function Assert(dev:uint, sig:uint, a:int, b:int):void {
			if (dbg) debug("Device="+dev+" signal="+sig+" va="+a+" vb="+b);
			device = dev;
			signal = sig;
			va = a;
			vb = b;
			IF = true;
			CPU.cycle(); /* Immediately start next CPU macrocycle */
		}
		
        private static function debug(msg:String):void {
        	m1.debug.print("IRQ: " + msg);
        }
	}
}